This key represents an individual commit template object in the commit_templates array.
The value is an object that defines a template for commit messages when saving changes. Each template object can contain optional label, template_path, template_string, wrap_width, extra_data, and _inputs keys.
Appears in
└── commit_templates
└── [*]Type
Object
Properties
This key defines additional template strings for building nested templates.
The value is an object that can contain any properties. Each property value can be any data type and specifies additional data to include in commit message templates.
Appears in: commit_templates[*].
Show examplesHide examples
In this example, we have configured a commit template with extra data to include a breaking change message.
commit_templates:
- label: Breaking change
template_string: '{message}{breaking_change|if=breaking_change_message}'
_inputs:
breaking_change_message:
type: text
extra_data:
breaking_change: ⚠️ {breaking_change_message}{
"commit_templates": [
{
"label": "Breaking change",
"template_string": "{message}{breaking_change|if=breaking_change_message}",
"_inputs": {
"breaking_change_message": {
"type": "text"
}
},
"extra_data": {
"breaking_change": "⚠️ {breaking_change_message}"
}
}
]
}This key defines which inputs are available at a given level of the configuration cascade.
This key has no default.
If undefined at higher levels of the configuration cascade, _inputs will default to any
values configured in the CloudCannon configuration file.
Appears in: create, [*], schemas.*, collections_config.*, file_config[*], pull_request_templates[*], commit_templates[*], Snippet.
Show examplesHide examples
In this example, we have configured the date_created key as a Date and Time Input, which will automatically populate when you create a file using this input. Editors cannot alter this input as the interface is disabled.
_inputs:
date_created:
type: datetime
label: Date of article creation
comment: UTC +0 timezone
context:
open: false
title: Help
icon: help
content: This date field will automatically populate when you create an article.
hidden: false
disabled: true
instance_value: NOW
cascade: true
options:
timezone: Etc/UTC{
"_inputs": {
"date_created": {
"type": "datetime",
"label": "Date of article creation",
"comment": "UTC +0 timezone",
"context": {
"open": false,
"title": "Help",
"icon": "help",
"content": "This date field will automatically populate when you create an article."
},
"hidden": false,
"disabled": true,
"instance_value": "NOW",
"cascade": true,
"options": {
"timezone": "Etc/UTC"
}
}
}
}In this example, we have configured the blog_tags key as a Multiselect Input in the blog Collection.
collections_config:
blog:
_inputs:
blog_tags:
type: multiselect
label: Blog type
comment: Select a blog type
context:
open: false
title: Help
icon: help
content: |
Blog tags help our users filter articles by topic.
options:
values:
- Opinion
- Feature
- Resource{
"collections_config": {
"blog": {
"_inputs": {
"blog_tags": {
"type": "multiselect",
"label": "Blog type",
"comment": "Select a blog type",
"context": {
"open": false,
"title": "Help",
"icon": "help",
"content": "Blog tags help our users filter articles by topic.\n"
},
"options": {
"values": [
"Opinion",
"Feature",
"Resource"
]
}
}
}
}
}
}This key defines the name of a commit template, which appears in the dropdown menu when saving changes.
The value is a string that specifies the label text for the template.
Appears in: commit_templates[*].
Show examplesHide examples
In this example, we have configured a commit template with the label "Default".
commit_templates:
- label: Default
template_string: '{commit_type}: {message|trim}'{
"commit_templates": [
{
"label": "Default",
"template_string": "{commit_type}: {message|trim}"
}
]
}This key defines the path to a file containing your commit template.
The value is a string that specifies a file path relative to the root directory. CloudCannon will use the contents of this file as the commit template.
CloudCannon will not use this file if template_string is also defined for the commit template.
Appears in: commit_templates[*].
Show examplesHide examples
In this example, we have configured a commit template to use a file at /.git/commit-message.txt.
commit_templates:
- label: Commit message from file
template_path: /.git/commit-message.txt{
"commit_templates": [
{
"label": "Commit message from file",
"template_path": "/.git/commit-message.txt"
}
]
}This key defines the template string for the commit message.
The value is a string that specifies the commit message template. This template can include template variables and filters.
CloudCannon will only use this template string if template_path is not set for the commit template.
Appears in: commit_templates[*].
Show examplesHide examples
In this example, we have configured a commit template with a template string that includes template variables.
commit_templates:
- label: Default
template_string: '{commit_type}: {message|trim}'
_inputs:
commit_type:
type: select
options:
values:
- feature
- fix{
"commit_templates": [
{
"label": "Default",
"template_string": "{commit_type}: {message|trim}",
"_inputs": {
"commit_type": {
"type": "select",
"options": {
"values": [
"feature",
"fix"
]
}
}
}
}
]
}This key defines the width of the text wrap in the commit message editor.
The value is a number that specifies the character width at which text wraps in the editor.
Appears in: commit_templates[*].
Show examplesHide examples
In this example, we have configured a commit template with a wrap width of 72 characters.
commit_templates:
- label: Default
template_string: '{message}'
wrap_width: 72{
"commit_templates": [
{
"label": "Default",
"template_string": "{message}",
"wrap_width": 72
}
]
}Examples
In this example, we have configured a commit template with a template string and input configuration.
commit_templates:
- label: Default
template_string: '{commit_type}: {message|trim}'
_inputs:
commit_type:
type: select
options:
allow_empty: true
values:
- feature
- fix
- test
cascade: true{
"commit_templates": [
{
"label": "Default",
"template_string": "{commit_type}: {message|trim}",
"_inputs": {
"commit_type": {
"type": "select",
"options": {
"allow_empty": true,
"values": [
"feature",
"fix",
"test"
]
},
"cascade": true
}
}
}
]
}